<!DOCTYPE html>
<html>
<head>
    <include file="./Application/Home/View/Tpl/head.html" />
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <include file="./Application/Home/View/Tpl/header.html" />



    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                首页
                <small>上网行为</small>
            </h1>
        </section>

        <!-- Main content -->
        <section class="content">

            <BR>
            <div class="row">


                <div class="col-md-12">
                    <div class="nav-tabs-custom">
                        <ul class="nav nav-tabs">
                            <li class="active" ><a href="#phone" data-toggle="tab">手机终端
                                <empty name="userinfo">
                                    <small class="label pull-right bg-green">&nbsp;&nbsp;0台</small>
                                    <else />
                                    <small class="label pull-right bg-green scanwifidata">&nbsp;&nbsp; {:count($userinfo)}台</small>
                                </empty>

                            </a></li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active" id="phone">

                                <div class="post">
                                    <div class="col-xs-12">
                                        <div style="float:  left" class="col-md-4 pull-right">
                                            <div class="input-group input-group-sm">
                                                <input type="text" class="form-control" id="filtertxt">
                                                <span class="input-group-btn">
                                                  <button class="btn btn-info btn-flat"  id="search" type="button">搜索</button>
                                                </span>
                                            </div>
                                        </div>

                                        <BR>
                                        <BR>
                                        <div class="box" id="stalist">

                                            <empty name="userinfo">
                                                尚未捕获到任何手机终端。
                                                <else />
                                                <!-- /.box-header -->
                                                <div class="box-body table-responsive no-padding">
                                                    <table class="table table-hover">
                                                        <tbody><tr>
                                                            <th>序号</th>
                                                            <th>终端IP地址</th>
                                                            <th>终端MAC地址</th>
                                                            <th>终端ID</th>
                                                            <th>查看上网日志</th>
                                                        </tr>
                                                        <foreach name="userinfo" item="vo" key="k" >

                                                            <tr>
                                                                <td>{$k+1} </td>
                                                                <td>
                                                                    {$vo['ip']}
                                                                </td>
                                                                <td>
                                                                    <span style="font-size: 14px" class="label label-primary">{$vo['mac']}</span>
                                                                </td>
                                                                <!--<td>{$vo['ssid']} </td> -->
                                                                <td>{$vo['term_id']} </td>
                                                                <td style="width: 30%">
                                                                    <button class="btn   btn-default getapsta"
                                                                            mac="{$vo['mac']}"
                                                                            data-toggle="modal" data-target="#myModal">
                                                                        <i class="fa fa-eye"></i> 关键信息监控
                                                                    </button>

                                                                    <button class="btn   btn-success geturls"
                                                                            mac="{$vo['mac']}"
                                                                            data-toggle="modal" data-target="#myModalUrl">
                                                                        <i class="fa fa-home"></i> 上网行为监控
                                                                    </button>
                                                                </td>
                                                            </tr>
                                                        </foreach>



                                                        </tbody></table>
                                                </div>
                                            </empty>
                                            <!-- /.box-body -->
                                        </div>
                                        <!-- /.box -->
                                    </div>
                                    <!-- /.user-block -->
                                    <p> &nbsp;
                                    </p>
                                    <ul class="list-inline">
                                    </ul>

                                </div>
                            </div>
                            <!-- /.post -->
                            <BR>
                        </div>
                        <!-- /.tab-pane -->


                    </div>
                    <!-- /.tab-content -->
                </div>
            </div>
            <div class="modal   fade"  id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog" style="width: 80%">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabel">关键信息监控</h4>
                        </div>
                        <div class="modal-body" id="stainfotr">

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>


            <div class="modal   fade"  id="myModalUrl" tabindex="-1" role="dialog" aria-labelledby="myModalLabelurl" aria-hidden="true">
                <div class="modal-dialog" style="width: 80%">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabelurl">上网行为监控</h4>
                        </div>
                        <div class="modal-body" id="urlinfotr">

                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>

        </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->


<include file="./Application/Home/View/Tpl/footer.html" />


<div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<include file="./Application/Home/View/Tpl/commjs.html" />
<script src="__PUBLIC__/dist/plugins/sparkline/jquery.sparkline.min.js" type="text/javascript"></script>

<script type="text/javascript">

    $(".getapsta").click(function(){
        var mac = $(this).attr('mac');
        $("#stainfotr").html('');
        $.ajax({
            url : "{:U('/Home/netlog/UserBehavi','',false)}",
            type : "post",
            dataType : "json",
            data: {mac:mac},
            timeout:30000,
            success:function(result){
                console.log(result);
                if(result.status){
                    if(result.data.length==0){
                        $("#stainfotr").html('<span class="badge bg-red">该终端没有任何关键信息。</span>');
                        return;
                    }
                    var list="";
                    var ip="";
                    var mac="";
                    for(var iloop=0; iloop<result.data.length;iloop++){
                        list+="<tr class=\"stainfotrs\">\n" +
                            "        <td style='width: 10%'>"+ (iloop + 1) +"</td>\n" +
                            "        <td style='width: 10%'>"+ result.data[iloop]['mac'] +"</td>\n" +
                            "        <td style='width: 20%'><span class=\"badge bg-green\">"+ result.data[iloop]['appid'] +"</span></td>\n" +
                            "        <td style='width: 20%'><span class=\"badge bg-red\">"+ result.data[iloop]['keytype'] + "</span></td>\n" +
                            "        <td style='width: 30%'>"+ result.data[iloop]['keyword'] + "</td>\n" +
                            "  </tr> ";

                        ip=result.data[iloop]['ip'];
                        mac=result.data[iloop]['mac'];
                    }
                    $("#myModalLabel").html('['+mac+']终端上网关键信息');

                    var tabdiv ="<table class=\"table table-bordered\">\n" +
                        "    <tbody><tr>\n" +
                        "     <th style=\"width: 10px\">编号</th>\n" +
                        "     <th>终端MAC地址</th>\n" +
                        "     <th>APP应用</th>\n" +
                        "     <th >关键信息类型</th>\n" +
                        "     <th>关键信息详情</th>\n" +
                        "\n" +
                        "    </tr>\n" +
                        "\n" +
                        "\n" + list +
                        "  </tbody></table>";

                    $("#stainfotr").append(tabdiv);
                }
                else {
                    $("#stainfotr").html('<span class="badge bg-red">该终端没有任何关键信息。</span>');
                }
            },
            error:function(msg){
                console.log(msg);      //执行错误
                $("#stainfotr").html('<span class="badge bg-red">该终端没有任何关键信息。</span>');
            }

        });
    });


    $(".geturls").click(function(){
        var mac = $(this).attr('mac');
        $("#urlinfotr").html('');
        $.ajax({
            url : "{:U('/Home/netlog/UserSurUrl','',false)}",
            type : "post",
            dataType : "json",
            data: {mac:mac},
            timeout:30000,
            success:function(result){
                console.log(result);
                if(result.status){
                    if(result.data.length==0){
                        $("#urlinfotr").html('<span class="badge bg-red">该终端没有任何上网浏览记录。</span>');
                        return;
                    }
                    var list="";

                    for(var iloop=0; iloop<result.data.length;iloop++){
                        list+="<tr class=\"stainfotrs\">\n" +
                            "        <td style='width: 10%'>"+ (iloop + 1) +"</td>\n" +
                            "        <td style='width: 10%'>"+ mac +"</td>\n" +
                             "        <td style='width: 30%'>"+ result.data[iloop]['url'] + "</td>\n" +
                            "  </tr> ";

                    }
                    $("#myModalLabelurl").html('['+mac+']终端上网浏览记录');

                    var tabdiv ="<table class=\"table table-bordered\">\n" +
                        "    <tbody><tr>\n" +
                        "     <th style=\"width: 10px\">编号</th>\n" +
                        "     <th>终端MAC地址</th>\n" +
                        "     <th>上网记录</th>\n" +
                        "\n" +
                        "    </tr>\n" +
                        "\n" +
                        "\n" + list +
                        "  </tbody></table>";

                    $("#urlinfotr").append(tabdiv);
                }
                else {
                    $("#urlinfotr").html('<span class="badge bg-red">该终端没有任何上网浏览记录。</span>');
                }
            },
            error:function(msg){
                console.log(msg);      //执行错误
                $("#urlinfotr").html('<span class="badge bg-red">该终端没有任何上网浏览记录。</span>');
            }

        });
    });
</script>

</body>
</html>


